subdir('d')

r_anal_sources = [
  'anal.c',
  'anplugs.c',
  'bb.c',
  'block.c',
  'function.c',
  'jmptbl.c',
  'cc.c',
  'class.c',
  'cond.c',
  'codemeta.c',
  'cycles.c',
  'data.c',
  'diff.c',
  'esil.c',
  'esil_stats.c',
  'esil_trace.c',
  'esil_plugin.c',
  'esil_handler.c',
  'esil_cfg.c',
  'esil_dfg.c',
  'fcn.c',
  'flirt.c',
  'global.c',
  'hint.c',
  'labels.c',
  'meta.c',
  'op.c',
  'pin.c',
  'reflines.c',
  'rtti.c',
  'rtti_msvc.c',
  'rtti_itanium.c',
  'sign.c',
  'switch.c',
  'type.c',
  'type_pdb.c',
  'dwarf_process.c',
  'value.c',
  'var.c',
  'vtable.c',
  'xrefs.c',
  join_paths('p','anal_6502.c'),
  join_paths('p','anal_6502_cs.c'),
  join_paths('p','anal_8051.c'),
  join_paths('p','anal_amd29k.c'),
  #join_paths('p','anal_arc.c'),
  join_paths('p','anal_arm_cs.c'),
  join_paths('p','anal_arm_gnu.c'),
  join_paths('p','anal_avr.c'),
  join_paths('p','anal_bf.c'),
  join_paths('p','anal_chip8.c'),
  join_paths('p','anal_cr16.c'),
  join_paths('p','anal_cris.c'),
  join_paths('p','anal_dalvik.c'),
  join_paths('p','anal_ebc.c'),
  join_paths('p','anal_gb.c'),
  join_paths('p','anal_h8300.c'),
  join_paths('p','anal_hexagon.c'),
  join_paths('p','anal_i4004.c'),
  join_paths('p','anal_i8080.c'),
  join_paths('p','anal_java.c'),
  join_paths('p','anal_m680x_cs.c'),
  join_paths('p','anal_m68k_cs.c'),
  join_paths('p','anal_malbolge.c'),
  join_paths('p','anal_mcore.c'),
  join_paths('p','anal_mips_cs.c'),
  join_paths('p','anal_mips_gnu.c'),
  join_paths('p','anal_loongarch_gnu.c'),
  join_paths('p','anal_msp430.c'),
  join_paths('p','anal_nios2.c'),
  join_paths('p','anal_null.c'),
  join_paths('p','anal_or1k.c'),
  join_paths('p','anal_pic.c'),
  join_paths('p','anal_ppc_cs.c'),
  join_paths('p','anal_ppc_gnu.c'),
  join_paths('p','anal_propeller.c'),
  join_paths('p','anal_pyc.c'),
  join_paths('p','anal_riscv.c'),
  join_paths('p','anal_rsp.c'),
  join_paths('p','anal_s390_cs.c'),
  join_paths('p','anal_sh.c'),
  join_paths('p','anal_snes.c'),
  join_paths('p','anal_sparc_cs.c'),
  join_paths('p','anal_sparc_gnu.c'),
  join_paths('p','anal_tms320.c'),
  join_paths('p','anal_tms320_c55x_plus.c'),
  #join_paths('p','anal_tms320c64x.c'),
  join_paths('p','anal_tricore.c'),
  join_paths('p','anal_v810.c'),
  join_paths('p','anal_v850.c'),
  join_paths('p','anal_v850_np.c'),
  join_paths('p','anal_vax.c'),
  join_paths('p','anal_wasm.c'),
  join_paths('p','anal_ws.c'),
  join_paths('p','anal_x86_cs.c'),
  join_paths('p','anal_xap.c'),
  join_paths('p','anal_xcore_cs.c'),
  #join_paths('p','anal_xtensa.c'),
  join_paths('p','anal_z80.c'),
  join_paths('p','esil_dummy.c'),
  #join_paths('arch','gb','meta_gb_cmt.c'),
  join_paths('arch','ebc','ebc_disas.c'),
  join_paths('arch','v850np','v850dis.c'),
  join_paths('arch','hexagon','hexagon_anal.c'),
  join_paths('arch','loongarch','gnu','loongarch-coder.c'),
  join_paths('arch','loongarch','gnu','loongarch-dis.c'),
  join_paths('arch','loongarch','gnu','loongarch-opc.c'),
  join_paths('..','asm','arch','amd29k','amd29k.c'),
  join_paths('..','asm','arch','v850','v850_disas.c'),
  join_paths('..','asm','arch','arm','winedbg','be_arm.c'),
  join_paths('..','asm','arch','avr','avr_disasm.c'),
  join_paths('..','asm','arch','avr','format.c'),
  join_paths('..','asm','arch','avr','disasm.c'),
  join_paths('..','asm','arch','cr16','cr16_disas.c'),
  join_paths('..','asm','arch','h8300','h8300_disas.c'),
  join_paths('..','asm','arch','hexagon','hexagon.c'),
  join_paths('..','asm','arch','hexagon','hexagon_disas.c'),
  join_paths('..','asm','arch','mcore','mcore.c'),
  join_paths('..','asm','arch','msp430','msp430_disas.c'),
  join_paths('..','asm','arch','or1k','or1k_disas.c'),
  join_paths('..','asm','arch','pic','pic_midrange.c'),
  join_paths('..','asm','arch','ppc','libvle','vle.c'),
  join_paths('..','asm','arch','propeller','propeller_disas.c'),
  join_paths('..','asm','arch','rsp','rsp_idec.c'),
  join_paths('..','asm','arch','tms320','tms320_dasm.c'),
  join_paths('..','asm','arch','tms320','c55x_plus','ins.c'),
  join_paths('..','asm','arch','tms320','c55x_plus','c55plus.c'),
  join_paths('..','asm','arch','tms320','c55x_plus','c55plus_decode.c'),
  join_paths('..','asm','arch','tms320','c55x_plus','decode_funcs.c'),
  join_paths('..','asm','arch','tms320','c55x_plus','hashtable.c'),
  join_paths('..','asm','arch','tms320','c55x_plus','utils.c'),
  join_paths('..','asm','arch','v810','v810_disas.c'),
  join_paths('..','asm','arch','wasm','wasm.c'),
  #join_paths('..','asm','arch','xtensa','gnu','xtensa-dis.c'),
  #join_paths('..','asm','arch','xtensa','gnu','elf32-xtensa.c'),
  #join_paths('..','asm','arch','xtensa','gnu','xtensa-isa.c'),
  #join_paths('..','asm','arch','xtensa','gnu','xtensa-modules.c'),
  join_paths('..','asm','arch','pyc','opcode_all.c'),
  join_paths('..','asm','arch','pyc','opcode_anal.c'),
  join_paths('..','asm','arch','pyc','opcode_arg_fmt.c'),
  join_paths('..','asm','arch','pyc','opcode.c'),
  join_paths('..','asm','arch','pyc','pyc_dis.c')
]
incdirs = [
    'arch/gb',
    'arch/hexagon'
]

if get_option('use_v35')
r_anal_sources += [
  join_paths('p','anal_arm_v35.c'),
  join_paths('..','asm','arch','arm','v35arm64','arch-arm64','disassembler','decode.c'),
  join_paths('..','asm','arch','arm','v35arm64','arch-arm64','disassembler','decode0.c'),
  join_paths('..','asm','arch','arm','v35arm64','arch-arm64','disassembler','decode1.c'),
  join_paths('..','asm','arch','arm','v35arm64','arch-arm64','disassembler','decode2.c'),
  join_paths('..','asm','arch','arm','v35arm64','arch-arm64','disassembler','decode_fields32.c'),
  join_paths('..','asm','arch','arm','v35arm64','arch-arm64','disassembler','decode_scratchpad.c'),
  join_paths('..','asm','arch','arm','v35arm64','arch-arm64','disassembler','encodings_dec.c'),
  join_paths('..','asm','arch','arm','v35arm64','arch-arm64','disassembler','encodings_fmt.c'),
  join_paths('..','asm','arch','arm','v35arm64','arch-arm64','disassembler','format.c'),
  join_paths('..','asm','arch','arm','v35arm64','arch-arm64','disassembler','gofer.c'),
  join_paths('..','asm','arch','arm','v35arm64','arch-arm64','disassembler','operations.c'),
  join_paths('..','asm','arch','arm','v35arm64','arch-arm64','disassembler','pcode.c'),
  join_paths('..','asm','arch','arm','v35arm64','arch-arm64','disassembler','regs.c'),
  join_paths('..','asm','arch','arm','v35arm64','arch-arm64','disassembler','sysregs.c')
]
incdirs += [
  join_paths('..','asm','arch','arm','v35arm64','arch-arm64','disassembler'),
]
endif

r_anal_sources += r_anal_d_sources

r_anal_inc = [
  platform_inc,
  include_directories(incdirs)
]

r_anal = library('r_anal', r_anal_sources,
  include_directories: r_anal_inc,
  c_args: library_cflags,
  dependencies: [
    r_util_dep,
    r_reg_dep,
    r_asm_dep,
    r_crypto_dep,
    r_search_dep,
    r_cons_dep,
    r_parse_dep,
    r_syscall_dep,
    r_flag_dep,
    r_hash_dep,
    java_dep,
    capstone_dep
  ],
  install: true,
  implicit_include_directories: false,
  install_rpath: rpath_lib,
  soversion: r2_libversion
)

r_anal_dep = declare_dependency(link_with: r_anal,
                                include_directories: r_anal_inc)

pkgconfig_mod.generate(r_anal,
  subdirs: 'libr',
  version: r2_version,
  name: 'r_anal',
  filebase: 'r_anal',
  libraries: pkgcfg_sanitize_libs,
  requires: [
    'r_util',
    'r_reg',
    'r_asm',
    'r_crypto',
    'r_parse',
    'r_syscall',
    'r_search',
    'r_cons',
    'r_flag'
  ],
  description: 'radare foundation libraries'
)
